fix(arrow/cdata): avoid unsafe.Slice on zero-length pointers - #4
Merged
Merged
Conversation
…pache#513) Slices from FFI may have an arbitrary pointer when the length is zero, but this is not allowed in Go, where the pointer must always be valid. I believe this fixes apache/arrow-go#28. I changed the instances of `unsafe.Slice` in `arrow/cdata` I could find to be robust when used with length zero. No, I don't have a Go setup at all. No. --------- Co-authored-by: Matt Topol <zotthewizard@gmail.com> Signed-off-by: jiaqizho <jiaqi.zhou@zilliz.com>
|
Thanks for opening a pull request! This pull request has been automatically converted to a draft because its title doesn't match Arrow's required format. If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or After updating the title, you can mark the pull request as ready for review. See also: |
Author
|
CI no pass because forbined by arrow origin repo(config to old). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport apache/arrow-go#513 for Milvus issue milvus-io/milvus#52233.
The C Data Interface permits an arbitrary pointer value for a zero-length buffer. Normalize such buffers before constructing a Go slice, and guard the other zero-length unsafe.Slice call sites in cdata.
This includes the upstream regression test for an all-null string array whose zero-length values buffer uses pointer 0x1.
Upstream commit: apache/arrow-go@41441ea
Tests: